home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 October / Ahoy_Magazine_85-10_1985_Double_L.d64 / 1541 clean (.txt) next >
Commodore BASIC  |  2022-10-26  |  6KB  |  203 lines

  1. 1 rem  1541 disk drive cleaning utility
  2. 2 rem   author - john derosa & the ahoy! staff
  3. 3 print"[147]":poke53280,11:poke53281,11
  4. 4 print"[158]the 1541 disk cleaning utility[156]"
  5. 5 print"[156][213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  6. 6 print"[194]              1541 [194]"
  7. 7 print"[194] [176][192][192][192][192][184][184][184][184][184][184][192][192][192][192][192][174] [194]"
  8. 8 print"[194] [171][192][192][192][192][162][162][162][162][162][162][192][192][192][192][192][179] [194]"
  9. 9 print"[194] [194][210]              [194] [194]"
  10. 10 print"[194][209][173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189] [194]"
  11. 11 print"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  12. 12 print"[158]             by john derosa"
  13. 13 print"           for ahoy! magazine[156]"
  14. 19 forz=1to6000:next
  15. 20 d$=" ":aa=0
  16. 30 print "[147] enter current date? ";
  17. 40 get a$:if a$="" then 40
  18. 50 if a$=chr$(13) then 100
  19. 60 print a$;:d$=d$+a$:goto 40
  20. 100 rem initialize screen
  21. 110 gosub 1200
  22. 120 print "do you want to read data from disk?(y/n)"
  23. 130 gosub 2500
  24. 140 gosub 1200
  25. 150 if an$="n" then 340
  26. 200 rem read data from disk drive
  27. 210 print "           insert data disk"
  28. 220 print "       press any key to read data"
  29. 230 get an$:if an$="" then 230
  30. 240 open15,8,15:open2,8,2,"cleandata,s,r"
  31. 250 gosub 1300
  32. 260 if a <> 0 then 300
  33. 270 input#2,dt$,tr,sc,nc,nm
  34. 280 gosub 1300
  35. 290 if a = 0 then 390
  36. 300 print "     data not read from disk"
  37. 310 print "     try again ? (y/n)"
  38. 320 gosub 2500
  39. 330 if an$="y" then close 2:gosub 1200:goto 200
  40. 340 gosub 1200:dt$=d$:tr=2:sc=30:nc=0:nm=15
  41. 350 print "         data not read from disk"
  42. 360 print "           default values used"
  43. 370 print "         press any key to continue"
  44. 380 get an$:if an$="" then 380
  45. 390 close 2:close 15
  46. 400 rem   display auto data
  47. 410 print "[147]"
  48. 420 print "      current date is ";d$;"[146]"
  49. 430 print " last date cleaned is: ";dt$
  50. 440 print " current track is: ";tr
  51. 450 print " current cleaning time is (sec): ";sc
  52. 460 print " number of times disk used is: ";nc
  53. 470 print " maximum cleanings per disk is: ";nm
  54. 480 print " number of cleanings left is: ";nm-nc;"[146]"
  55. 490 print "    do you want to change data? (y/n)"
  56. 495 gosub 2500:if an$="n" then 800
  57. 500 rem   change auto data
  58. 510 print "[147]"
  59. 520 print " last date cleaned is ";dt$
  60. 530 print "  enter new date";:input dt$
  61. 540 print " current track is ";tr
  62. 550 print "  enter new track (1-35)";:input tr
  63. 560 if tr<1  then print "[145][145][145][145]":goto 540
  64. 570 if tr>35 then print "[145][145][145][145]":goto 540
  65. 590 print " current cleaning time is ";sc
  66. 600 print "  enter new time (< 300)";:input sc
  67. 610 if sc>300 then print "[145][145][145][145]":goto 590
  68. 620 if sc<1 then print "[145][145][145][145]":goto 590
  69. 630 print " number of times disk used is ";nc
  70. 640 print "  enter new number ";:input nc
  71. 650 print " maximum cleanings per disk is";nm
  72. 660 print "  enter new maximum ";:input nm
  73. 670 print "   do you want to change data? (y/n)"
  74. 680 gosub 2500
  75. 690 if an$="y" then 500
  76. 700 print "   save this data on disk (y/n)"
  77. 710 gosub 2500
  78. 720 if an$="y" then gosub 1400
  79. 800 rem  auto cleaning
  80. 805 gosub 1200:gosub 1000
  81. 810 nl=nm-nc
  82. 815 if nl>o then 870
  83. 820 print "            *****warning*****"
  84. 825 print "       cleaning disk is used up"
  85. 830 print "       (";nl;" cleanings left on disk)"
  86. 835 print " do you want to continue cleaning? (y/n)"
  87. 840 gosub 2500
  88. 845 if an$="y" then gosub 1200:gosub 1000:goto 870
  89. 850 print "    do you want to change data? (y/n)"
  90. 855 gosub 2500
  91. 860 if an$="y" then 500
  92. 865 goto 955
  93. 870 gosub 2200:gosub 1200:gosub 1000
  94. 875 print "      insert cleaning disk in drive"
  95. 880 print "     press any key to start cleaning"
  96. 885 get an$:if an$="" then 885
  97. 890 gosub 1200:gosub 1000
  98. 895 print "    cleaning[146]"
  99. 900 print "    press any key to manually stop"
  100. 905 if et>sc then 920
  101. 910 gosub 1700
  102. 915 get an$:if an$="" then 905
  103. 920 gosub 2000:gosub 1200:gosub 1000
  104. 925 print "  update data disk? (y/n)"
  105. 930 gosub 2500
  106. 935 if an$="n" then 955
  107. 940 nc=nc+1:tr=tr+2:dt$=d$
  108. 945 if tr>35 then tr=1
  109. 950 gosub 1400
  110. 955 print "[147]  program ended":end
  111. 1000 rem subroutine-update status line
  112. 1010 if mf=1 then 1040
  113. 1020 poke 1266,143:poke 1267,134:poke 1268,134
  114. 1030 goto 1050
  115. 1040 poke 1266,143:poke 1267,142:poke 1268,32
  116. 1050 t=tr/10:if t<1 then t2=-144:t1=tr:goto 1070
  117. 1060 t1=int(t):t2=tr-10*t1
  118. 1070 poke 1277,t1+176:poke 1278,t2+176
  119. 1075 s=sc/100:if s<1 then s0=0:goto 1077
  120. 1076 s0=int(s)
  121. 1077 sa=sc-s0*100
  122. 1080 s=sa/10:if s<1 then s2=sa:s1=0:goto 1100
  123. 1090 s1=int(s):s2=sa-10*s1
  124. 1100 poke 1287,s0+176:poke 1288,s1+176:poke 1289,s2+176
  125. 1105 e=et/100:if e<1 then e0=0:goto 1107
  126. 1106 e0=int(e)
  127. 1107 ea=et-e0*100
  128. 1110 e=ea/10:if e<1 then e2=ea:e1=0:goto 1130
  129. 1120 e1=int(e):e2=ea-10*e1
  130. 1130 poke 1298,e0+176:poke 1299,e1+176:poke 1300,e2+176
  131. 1140 return
  132. 1200 rem subroutine-set up screen
  133. 1210 print "[147]"spc(4)"1541 disk drive cleaning utility"
  134. 1220 print " drive    head at     total     elapsed"
  135. 1230 print " motor     track     seconds    seconds"
  136. 1240 print "[195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195]"
  137. 1250 return
  138. 1300 rem subroutine-read error channel
  139. 1310 input#15,a,b$,c,d
  140. 1320 if a=0 then return
  141. 1340 gosub 1200:gosub 1000
  142. 1350 print "     disk error * ";b$
  143. 1360 close 15
  144. 1370 return
  145. 1400 rem subroutine-save auto data
  146. 1410 gosub 1200:gosub 1000
  147. 1420 print "           insert data disk"
  148. 1430 print "    press any key to save auto data "
  149. 1440 get an$:if an$="" then 1440
  150. 1450 open 15,8,15:open2,8,2,"@0:cleandata,s,w"
  151. 1460 gosub 1300:if a <> 0 then 1500
  152. 1470 print#2,dt$;",";tr;",";sc;",";nc;",";nm
  153. 1480 gosub 1300:if a <> 0 then 1500
  154. 1490 close2:close15:return
  155. 1500 print "     data not saved!"
  156. 1520 print "     try again? (y/n)"
  157. 1530 gosub 2500:close 2:close 15
  158. 1540 if an$="n" then return
  159. 1550 goto 1400
  160. 1700 rem subroutine-motor on
  161. 1710 if mf=1 then 1730
  162. 1720 z=54272:tt=ti:for l=z to z+24:poke l,0:next l
  163. 1730 poke z+5,9:poke z+6,0:pokez+24,15:poke z+4,33
  164. 1740 et=int((ti-tt)/60)
  165. 1750 if sw=1 then 1770
  166. 1760 poke z+1,25:poke z,170:sw=1:goto 1780
  167. 1770 poke z+1,20:poke z,150:sw=0
  168. 1780 gosub 1000:poke z+4,32
  169. 1790 if mf=1 then return
  170. 1800 open15,8,15
  171. 1810 print#15,"m-r"chr$(0)chr$(28)
  172. 1820 get#15,x$:x=asc(x$+chr$(0))
  173. 1830 bi=xor4
  174. 1840 print#15,"m-w"chr$(0)chr$(28)chr$(1)chr$(bi)
  175. 1850 mf=1:close 15
  176. 1860 return
  177. 2000 rem subroutine-motor off
  178. 2010 z=54272:for l=z to z+24:poke l,0:next l
  179. 2020 open15,8,15
  180. 2030 bi=x
  181. 2040 print#15,"m-w"chr$(0)chr$(28)chr$(1)chr$(bi)
  182. 2050 mf=0:close 15
  183. 2060 return
  184. 2200 rem subroutine-move head to track
  185. 2220 print "        insert any formatted disk"
  186. 2230 print "        press any key to move head"
  187. 2240 get an$:if an$="" then 2240
  188. 2250 open 15,8,15:open 2,8,2,"#"
  189. 2260 print#15,"u1 2 0";tr;"0"
  190. 2270 gosub 1300
  191. 2280 if a=0 then close 2:close 15:return
  192. 2290 print "     move head failed"
  193. 2300 print "     head not on proper track"
  194. 2400 print "        try again? (y/n)"
  195. 2410 gosub 2500:close 2:close 15
  196. 2420 if an$="y" then gosub 1200:gosub 1000:goto 2220
  197. 2430 return
  198. 2500 rem subroutine - get (y/n) answer
  199. 2510 get an$:if an$="" then 2510
  200. 2520 if an$="y" then return
  201. 2530 if an$="n" then return
  202. 2540 goto 2510
  203.